package com.cxhc.system.service.cockpit.impl;

import com.cxhc.common.utils.StringUtils;
import com.cxhc.system.domain.cockpit.CmInfo;
import com.cxhc.system.mapper.cockpit.CmInfoMapper;
import com.cxhc.system.service.cockpit.ICmInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CmInfoServiceImpl implements ICmInfoService {

    @Autowired
    private CmInfoMapper cmInfoMapper;

    @Override
    public List<CmInfo> queryCmInfo() {
        List<CmInfo> cmInfos = cmInfoMapper.queryCnInfo();
        for (CmInfo cmInfo : cmInfos) {
            if (!StringUtils.isEmpty(cmInfo.getContent())){
                String[] split = cmInfo.getContent().split("\"");
                if (split.length >= 2){
                    cmInfo.setContent(split[1]);
                }
            }
        }
        return cmInfos;
    }
}
